home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950929-19951130 / 000101_news@columbia.edu_Fri Oct 13 19:20:26 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA21315
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Sat, 14 Oct 1995 07:58:14 -0400
  3. Received: by apakabar.cc.columbia.edu id AA11823
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Sat, 14 Oct 1995 07:58:12 -0400
  5. Newsgroups: comp.protocols.kermit.misc
  6. Path: news.columbia.edu!panix!news.mathworks.com!news.kei.com!simtel!swidir.switch.ch!scsing.switch.ch!news.belwue.de!news.uni-ulm.de!rz.uni-karlsruhe.de!snert!flatlin!bad
  7. From: bad@flatlin.ka.sub.org (Christoph Badura)
  8. Subject: Re: is there any effect of ANDing a byte with 0377 (octal)?
  9. Date: Fri, 13 Oct 1995 19:20:26 GMT
  10. Message-Id: <DGEJ23.1B4@flatlin.ka.sub.org>
  11. References: <45ja2n$mqq@cnj.digex.net>
  12. Followup-To: comp.lang.c
  13. Organization: Guru Systems/Funware Department
  14. Lines: 27
  15. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  16.  
  17. Why "Distribution: usa?"  Do you think we Europeans can't answer that
  18. question?
  19.  
  20. In <45ja2n$mqq@cnj.digex.net> hashmi@cnj.digex.net (Atiqullah Hashmi) writes:
  21. >In one communcation software I work with, I see that  before transmiting
  22. >some chars., they are ANDed with '0377' (octal 377) which  is 011 111 111.
  23. >It seems that it will just leave the 8-bit byte as is.
  24.  
  25. Assuming that your communications software is written in C I can think
  26. of two possible reasons.
  27.  
  28. 1) Assuring that it is indeed an 8 bit character.  The C language
  29. doesn't specify the number of bits in a char. (Ansi C provides the
  30. CHAR_BIT (sp?) #defined constant, though.)  I believe some machines
  31. had 9 bit characters.
  32.  
  33. 2) KNR C parameter passing.  In KNR C there's no way to pass a char
  34. parameter to a function.  It gets automatically promoted to int.
  35. Further, chars might be signed or unsigned quantities.  If a "signed"
  36. char has the high bit set it is sign-extended when passed to function
  37. or assigned to an int.
  38.  
  39. -- 
  40. Christoph Badura    bad@flatlin.ka.sub.org        +49 721 606137
  41.  
  42. Es genuegt nicht, keine Gedanken zu haben;
  43. man muss auch unfaehig sein, sie auszudruecken.  - Karl Kraus